<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增社工')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-worker-add">
            <div class="form-group">
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">年龄：</label>
                <div class="col-sm-8">
                    <input name="age" class="form-control" type="text">
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-3 control-label">电话：</label>
                <div class="col-sm-8">
                    <input name="phone" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">头像：</label>
                <div class="col-sm-8">
                    <input id="avatarFile" accept="image/jpg,image/jpeg,image/png" name="file"  class="form-control" type="file">
                    <img style="width: 80px ;height: auto;"  th:src="*{avatar}" id="avatarImg"  />
                    <input style="display: none" id="avatar" name="avatar" class="form-control" th:value="*{avatar}"   type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">身份证号码：</label>
                <div class="col-sm-8">
                    <input name="code" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">身份证正面：</label>
                <div class="col-sm-8">
                    <input id="codeAPhotoFile" accept="image/jpg,image/jpeg,image/png" name="file"  class="form-control" type="file">
                    <img style="width: 80px ;height: auto;"  th:src="*{codeAPhoto}" id="codeAPhotoImg"  />
                    <input style="display: none" id="codeAPhoto" name="codeAPhoto" class="form-control" th:value="*{codeAPhoto}"  type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">身份证反面：</label>
                <div class="col-sm-8">
                    <input id="codeBPhotoFile" accept="image/jpg,image/jpeg,image/png" name="file"  class="form-control" type="file">
                    <img style="width: 80px ;height: auto;"  th:src="*{codeBPhoto}" id="codeBPhotoImg"  />
                    <input style="display: none" id="codeBPhoto" name="codeBPhoto" class="form-control" th:value="*{codeBPhoto}"  type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">户籍所在地：</label>
                <div class="col-sm-8">
                    <input name="registeredResidence" class="form-control" type="text">
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-3 control-label">职业认定：</label>
                <div class="col-sm-8">
                    <input name="professionalCertification" class="form-control" type="text">
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-3 control-label">个人描述：</label>
                <div class="col-sm-8">
                    <textarea name="des" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">性别 1男 2女：</label>
                <div class="col-sm-8">
                    <select name="sex" class="form-control m-b">
                        <option value="1">男</option>
                        <option value="2">女</option>
                    </select>
<!--                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
                </div>
            </div>
<!--            <div class="form-group">-->
<!--                <label class="col-sm-3 control-label">身份1已认证 2未认证：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="codeAuth" th:field="*{codeAuth}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--        </form>-->
<!--    </div>-->
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "jiajia/worker"
        $("#form-worker-add").validate({
            focusCleanup: true
        });


        function submitHandler() {
            if ($.validate.form()) {
                var formData = new FormData();
                formData.append('avatarFile', $("#avatarFile")[0].files[0]);
                formData.append('codeAPhotoFile', $("#codeAPhotoFile")[0].files[0]);
                formData.append('codeBPhotoFile', $("#codeBPhotoFile")[0].files[0]);
                $.modal.loading("图片上传中，请稍后...")
                $.ajax({
                    url: "/common/admin/upload/up/more",
                    data: formData,
                    type: "post",
                    dataType: "json",
                    processData: false,
                    contentType: false,
                    success: function(result) {
                        $("#avatar").val(result.avatarFile_url);
                        $("#codeAPhoto").val(result.codeAPhotoFile_url);
                        $("#codeBPhoto").val(result.codeBPhotoFile_url);
                        $.operate.save(prefix + "/add", $('#form-worker-add').serialize());
                    }
                })
            }
        }




        $("input[name='addtime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>